from django.db import models

# Create your models here.
#权限
class Permission(models.Model):
    name=models.CharField(max_length=32)
    url=models.CharField(max_length=32)
    pid=models.IntegerField()
    class Meta:
        db_table='permission'

class Role(models.Model):

    permissions=models.CharField(max_length=12)
    pid=models.IntegerField()
    class Meta:
        db_table='role'
    #职务
class User(models.Model):
    password=models.CharField(max_length=32)
    phone=models.CharField(max_length=32)
    roles=models.ForeignKey('Role',on_delete=models.CASCADE)
    class Meta:
        db_table='user'


class Permission_Role(models.Model):
    permission_id=models.ForeignKey('Permission',on_delete=models.CASCADE)
    role_id=models.ForeignKey('Role',on_delete=models.CASCADE)
    class Meta:
        db_table='permission_role'
